//package cn.enjoy.rabbitmq.config;
//
//import com.google.common.collect.Maps;
//import org.springframework.amqp.core.Binding;
//import org.springframework.amqp.core.BindingBuilder;
//import org.springframework.amqp.core.CustomExchange;
//import org.springframework.amqp.core.Queue;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//import java.util.Map;
//
///**
// * @author K
// * @date 2022-07-20 22:21
// */
//@Configuration
//public class MqQueueDelayConfig {
//
//    /**
//     * 延迟队列
//     */
//    @Bean("delayQueue")
//    public Queue delayQueue() {
//        return new Queue("delay.queue", true);
//    }
//
//    /**
//     * 延迟队列交换器, x-delayed-type 和 x-delayed-message 固定
//     */
//    @Bean
//    public CustomExchange delayExchange() {
//        Map<String, Object> args = Maps.newHashMap();
//        args.put("x-delayed-type", "direct");
//        return new CustomExchange("delay.mode", "x-delayed-message", true, false, args);
//    }
//
//    /**
//     * 延迟队列绑定自定义交换器
//     *
//     * @param delayQueue    队列
//     * @param delayExchange 延迟交换器
//     */
//    @Bean
//    public Binding delayBinding(@Qualifier("delayQueue") Queue delayQueue, CustomExchange delayExchange) {
//        return BindingBuilder.bind(delayQueue).to(delayExchange).with("delay.notice").noargs();
//    }
//
//}
